<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
	<meta name="language" content="en"/>

	<link rel="icon" href="<?php echo Yii::app()->request->baseUrl; ?>/favicon.ico" type="image/x-icon"/>
	<!-- blueprint CSS framework -->
	<link rel="stylesheet" type="text/css" href="<?php echo Yii::app()->request->baseUrl; ?>/css/screen.css"
	      media="screen, projection"/>
	<link rel="stylesheet" type="text/css" href="<?php echo Yii::app()->request->baseUrl; ?>/css/print.css"
	      media="print"/>
	<!--[if lt IE 8]>
	<link rel="stylesheet" type="text/css" href="<?php echo Yii::app()->request->baseUrl; ?>/css/ie.css"
	      media="screen, projection"/>
	<![endif]-->

	<title><?php echo CHtml::encode($this->pageTitle); ?></title>
</head>

<body>

<div class="container" id="page">
<?php   $menuarray = ApplicationConfig::getMenu();
		
		$generic = array(
                    '0' => array(
                            'url' => ApplicationConfig::getURL('','site','login'),
                            'label' => "Login",
                            'visible' => Yii::app()->user->isGuest,
                        ),

                    '1' => array(
                            'url' => ApplicationConfig::getURL('','site','logout'),
                            'label' => "Logout",
                            'visible' => !Yii::app()->user->isGuest,
                        	'itemOptions'=>array('style'=>'float: right;')
                        ),

                );

        if(empty($menuarray)){
        	$menuarray = $generic;
        } else
        {
        	$menuarray = array_merge($menuarray, $generic);
        }
        
       
       // echo "<pre>";print_r($menuarray);exit;
        
?>
		
	<?php 
	$objconfig = Config::getModel('CONFIG-ID',array('configID'=>1));
	if (!empty($objconfig->logo))
			{
				$brandOptions = array();
				$brandOptions['style'] = 'padding: 0 !important;position:absolute;margin-left: -8%;';
				$brand = CHtml::openTag('a', $brandOptions).CHtml::openTag('img', array('src'=>Yii::app()->getBaseUrl().'/images/'.$objconfig->logo,'alt'=>$objconfig->site_name,'style'=>'width:35%;')).'</a>';
			}
			else 
			{
				$brandOptions = array();
				$brandOptions['href'] = ApplicationConfig::getURL("", "site", "index");
					$brand = CHtml::openTag('a', $brandOptions).$objconfig->site_name.'</a>';
				
			}
	
	$this->widget('bootstrap.widgets.TbNavbar', array(
	'type' => 'inverse', // null or 'inverse'
	'brand' => $brand,
	'brandUrl' => ApplicationConfig::getURL('','site','login'),
	'collapse' => true, // requires bootstrap-responsive.css
	'items' => array(
		
		array(
			'class' => 'bootstrap.widgets.TbMenu',
			'items' => $menuarray,
		),
		//'<form class="navbar-search pull-left" action=""><input type="text" class="search-query span2" placeholder="Search"></form>',
		//(!Yii::app()->user->isGuest) ? '<p class="navbar-text pull-right">Logged in as <a href="#">username</a></p>' : '',
		/*array(
			'class' => 'bootstrap.widgets.TbMenu',
			'htmlOptions' => array('class' => 'pull-right'),
			'items' => array(
				array('label' => 'Link', 'url' => '#'),
				'---',
				array('label' => 'Dropdown', 'url' => '#', 'items' => array(
					array('label' => 'Action', 'url' => '#'),
					array('label' => 'Another action', 'url' => '#'),
					array('label' => 'Something else here', 'url' => '#'),
					'---',
					array('label' => 'Separated link', 'url' => '#'),
				)),
			),
		),*/
	),
)); ?>
	<!-- mainmenu -->
	<div class="container" style="margin-top:80px">
		<?php if (isset($this->breadcrumbs)): ?>
			<?php $this->widget('bootstrap.widgets.TbBreadcrumbs', array(
			'links' => $this->breadcrumbs,
		)); ?><!-- breadcrumbs -->
		<?php endif?>

		<?php echo $content; ?>
		<hr/>
		
		<!-- footer -->
	</div>
</div>
<!-- page -->
</body>
</html>